import { request } from '@/service/request'
import type { AppItem } from '@/types/userApp'

const BASE_PATH = '/mock'

// 获取用户所有应用
export const getUserApps = () => {
  return request.get(`${BASE_PATH}/user/apps`)
}

// 获取单个应用详情
export const getAppById = (id: number) => {
  return request.get(`${BASE_PATH}/user/app/${id}`)
}

// 创建新应用
export const createApp = (appData: Partial<AppItem>) => {
  return request.post(`${BASE_PATH}/user/app`, appData)
}

// 快捷创建应用
export const quickCreateApp = () => {
  return request.post(`${BASE_PATH}/user/app/quick`)
}

// 更新应用
export const updateApp = (id: number, appData: Partial<AppItem>) => {
  return request.put(`${BASE_PATH}/user/app/${id}`, appData)
}

// 删除应用
export const deleteApp = (id: number) => {
  return request.delete(`${BASE_PATH}/user/app/${id}`)
}

// 获取会话列表（如果需要的话）
export const getSessions = () => {
  return request.get(`${BASE_PATH}/user/sessions`)
}

// 获取单个会话详情（如果需要的话）
export const getSessionById = (id: number) => {
  return request.get(`${BASE_PATH}/user/session/${id}`)
}